// 专门管理请求 

define(['jquery'], () => {
    return {
        baseUrl: "http://www.xiongmaoyouxuan.com/api",
        getHomePageList() { // 首页列表
            return new Promise((resolve, reject) => {
                $.get('/libs/json/homePageList.json', resolve)
            })
        },
        getHomePageBrand() { // 首页品牌展示
            return new Promise(resolve => {
                $.get("http://rap2.taobao.org:38080/app/mock/259681/home/brandShow", resolve)
            })
        },
        getTab() { //首页导航
            return new Promise(resolve => {
                $.get(`${this.baseUrl}/tabs?sa=`, resolve)
            })
        },
        getList(id) { //根据 tab 的 id 渲染列表页
            // TODO:加载更多
            return new Promise(resolve => {
                $.get(`${this.baseUrl}/tab/${id}?start=0`, resolve)
            })

        },
        getDetails(id) { //根据 id 获取详情页数据
            return new Promise(resolve => {
                $.get(`${this.baseUrl}/detail?id=${id}&normal=1&sa=`, resolve)
            })
        }

    }
})